/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans;

import core.Book;
import core.Shop;
import java.util.Collection;

/**
 * Decorator pattern used for the Shop class to extend bean properties
 * @author Peter
 */
public class WebShopBean {
    boolean selected;
    Shop shop;

    /** Creates a new instance of WebShopBean */
    public WebShopBean(Shop shop) {
        this.shop = shop;
        this.selected = false;
    }

    /**
     *
     * constructs a new WebShopBeen as a clone,
     * all ementents except books
     * @param toBeCloned
     */
    public WebShopBean(WebShopBean toBeCloned)
    {


         shop = new Shop(
                toBeCloned.getId(),
                toBeCloned.getName(),
                toBeCloned.getDescription(),
                toBeCloned.getWebLink(),
                toBeCloned.getXmlSource(),
                null
                );
        selected = false;
    }
    public String getXmlSource() {
        return shop.getXMLSource();
    }

    public void setXmlSource(String XMLSource) {
        shop.setXMLSource(XMLSource);
    }

    public Collection<Book> getBooks() {
        return shop.getBooks();
    }

    public void setBooks(Collection<Book> books) {
        shop.setBooks(books);
    }

    /**
     *
     * @return
     */
    public long getId() {
        return shop.getId();
    }

    /**
     *
     * @return
     */
    public String getName() {
        return shop.getName();
    }

    /**
     *
     * @return
     */
    public String getDescription() {
        return shop.getDescription();
    }

    /**
     *
     * @return
     */
    public String getWebLink() {
        return shop.getWebLink();
    }

    /*
     *  Set methods
     */
    /**
     *
     * @param id
     */
    public void setId(long id) {
        shop.setId(id);
    }

    /**
     *
     * @param name
     */
    public void setName(String name) {
        shop.setName(name);
    }

    /**
     *
     * @param description
     */
    public void setDescription(String description) {
        shop.setDescription(description);
    }

    /**
     *
     * @param webLink
     */
    public void setWebLink(String webLink) {
        shop.setWebLink(webLink);
    }

        public boolean getSelected()
    {
        // for debugging
        //System.out.println("getSelecten");
        return selected;
    }
    /**
     * get selection
     * @param selected
     */
    public void setSelected(boolean selected)
    {
        // for debugging
        //if(selected == true) System.out.println(user.getId() + "Selected");
        //if(selected == false) System.out.println(user.getId() + "unselected");
        this.selected = selected;
    }

    public void setShop(Shop shop)
    {
        this.shop = shop;
    }

    public Shop getShop()
    {
        return shop;
    }
}
